import { request } from '@/utils/request';
import CRUD from '@/utils/request/CRUD';

// 用户CRUD
export const userCRUD = CRUD('/system/user');

// 获取精简用户列表
export function getSimpleUserList() {
  return request.get({
    url: '/system/user/simple-list',
  });
}
// 获取用户
export function getSimpleUserListByDeptId(params: Record<string, any>) {
  return request.get({
    url: '/system/user/list-all-simple-by-deptId',
    params
  });
}

// 编辑用户状态
export function updateUserStatus(data: any) {
  return request.put({
    url: '/system/user/update-status',
    data,
  });
}

// 重置密码
export function resetPassword(data: any) {
  return request.put({
    url: '/system/user/update-password',
    data,
  });
}

// 获取所有精简用户列表
export function getAllSimpleUserlist() {
  return request.get({
    url: '/system/user/get-all-user',
  });
}

// 根据公司id和角色id获取用户列表
export function getUserListByCompanyIdAndRoleId(params: Record<string, any>) {
  return request.get({
    url: '/system/user/get-user-list-by-company-id-and-role',
    params,
  });
}

// 根据角色获取用户列表
export function getUserListByRoleCode(params: Record<string, any>) {
  return request.get({
    url: '/system/user/get-user-list-by-role-code',
    params,
  });
}
// 用户密码重置
export function updateUserPassword(data: any) {
  return request.put({
    url: '/system/user/profile/update-password',
    data,
  });
}

// 重置用户信息
export function resetUserInfo(data: any) {
  return request.post({
    url: '/system/user/reset-user-info',
    data,
  });
}